package com.hsu.easyweb.common;

/**
 * 定义了通用的错误码和对应的错误信息，用于在系统中统一处理错误。
 * @ClassName: ErrorCode
 * @author Hsu琛君珩
 * @date 2024-09-09
 * @apiNote
 * @version v1.0
 */
public enum ErrorCode implements Error {
    SUCCESS(0, "ok"),
    PARAMS_ERROR(40000, "请求参数错误"),
    NOT_LOGIN_ERROR(40100, "未登录"),
    NO_AUTH_ERROR(40101, "无权限"),
    NOT_FOUND_ERROR(40400, "请求数据不存在"),
    FORBIDDEN_ERROR(40300, "禁止访问"),
    SYSTEM_ERROR(50000, "系统内部异常"),
    OPERATION_ERROR(50001, "操作失败");

    private final int code;
    private final String message;

    private ErrorCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public int getCode() {
        return this.code;
    }

    @Override
    public String getMessage() {
        return this.message;
    }
}
